
#include "postorder.h"
void postorder(Node* root, vector<int>& cache) {
  if (!root)
    return;
  else {
    for (auto child : root->children) {
      postorder(child, cache);
    }
    cache.push_back(root->val);
  }
}
vector<int> postorder(Node* root) {
  vector<int> cache;
  postorder(root, cache);
  return cache;
}